<?php
class workon_model extends CI_Model {
        
    public function __construct()
    {
        parent::__construct();
        $this->load->model('query_workon');
        $this->config->load('iss_config');
    }
    
    public function get_workon(){
         $sql = "SELECT  emp_id,pro_id FROM ".$this->config->item('schema').".workon";
         return $this->query_workon->workon_query($sql);
    }

    public function get_workon_by_id($id){
         
         $sql = "SELECT emp_id,pro_id FROM ".$this->config->item('schema').".workon where emp_id='".$id."'";
         return $this->query_workon->workon_query($sql);
    }
  
   public function update_workon($data ){
       $this->session->set_flashdata('type', 'update');
        $this->session->set_flashdata('table', 'workon');
        $sql = "UPDATE ".$this->config->item('schema').".workon
               SET 
                    pro_id='".$data['proj_id']."' "
                . "WHERE emp_id='".$data['empp_id']."'";
        return $this->query_workon->update_workon_query($sql);
   }

    public function  store_workon($data){
         $this->session->set_flashdata('type', 'add');
        $this->session->set_flashdata('table', 'Workon');
        $sql = "INSERT INTO ".$this->config->item('schema').".Workon(emp_id,pro_id) "
                . "values ('".$data['empp_id']."','".$data['proj_id']."')" ;
         return $this->query_workon->update_workon_query($sql);
    }

    public function delete_workon($id){
        $this->session->set_flashdata('type', 'del');
        $this->session->set_flashdata('table', 'Workon');
        $sql = "DELETE FROM ".$this->config->item('schema').".workon WHERE emp_id='".$id."'";
        return $this->query_workon->update_workon_query($sql);
    }

}